<?php
/**
 * Display links to active BuddyPress specific plugins/extensions settings' pages
 *
 * @package    BuddyPress Toolbar
 * @subpackage Plugin/Extension Support
 * @author     David Decker - DECKERWEB
 * @copyright  Copyright 2012, David Decker - DECKERWEB
 * @license    http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
 * @link       http://genesisthemes.de/en/wp-plugins/buddypress-toolbar/
 * @link       http://twitter.com/#!/deckerweb
 *
 * @since 1.0
 */

/**
 * BuddyPress ScholarPress Courseware (free, by ScholarPress Dev Crew)
 *
 * @since 1.0
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-courseware/courseware.php' ) ) || class_exists( 'BPSP_Courses' ) ) {
	$menu_items['ext-bpcourseware'] = array(
		'parent' => $extensions,
		'title'  => __( 'BuddyPress ScholarPress Courseware', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=bp-courseware' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BuddyPress ScholarPress Courseware', 'buddypress-toolbar' ) )
	);
}  // end-if BP Courseware


/**
 * BP Group Organizer (free, by David Dean)
 *
 * @since 1.0
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'bp-group-organizer/index.php' ) ) || function_exists( 'bp_group_organizer_admin' ) ) {
	$menu_items['ext-bpgrouporganizer'] = array(
		'parent' => $extensions,
		'title'  => __( 'BP Group Organizer', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=group_organizer' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BP Group Organizer', 'buddypress-toolbar' ) )
	);
}  // end-if BP Group Organizer


/**
 * BP Group Hierarchy (free, by David Dean)
 *
 * @since 1.0
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'bp-group-hierarchy/index.php' ) ) || class_exists( 'BP_Groups_Hierarchy' ) ) {
	$menu_items['ext-bpgrouphierarchy'] = array(
		'parent' => $extensions,
		'title'  => __( 'BP Group Hierarchy', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=bp_group_hierarchy_settings' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BP Group Hierarchy', 'buddypress-toolbar' ) )
	);
}  // end-if BP Group Hierarchy admin.php?page=group_avatar


/**
 * BuddyPress Groups Extras (free, by slaFFik)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-groups-extras/bpge.php' ) ) || function_exists( 'bpge_load' ) ) {
	$menu_items['extbpge'] = array(
		'parent' => $extensions,
		'title'  => __( 'BP Groups Extras', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=bpge-admin' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BP Groups Extras', 'buddypress-toolbar' ) )
	);
	$menu_items['extbpge-gpages'] = array(
		'parent' => $extbpge,
		'title'  => __( 'Groups Pages', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=gpages' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Groups Pages', 'buddypress-toolbar' ) )
	);
}  // end-if BP Groups Extras


/**
 * BuddyPress Group Default Avatar (free, by Vernon Fowler)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-default-group-avatar/buddypress-default-group-avatar.php' ) ) || function_exists( 'BPDGA_default_get_group_avatar' ) ) {
	$menu_items['ext-bpgroupavatar'] = array(
		'parent' => $extensions,
		'title'  => __( 'Group Default Avatar', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=group_avatar' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Group Default Avatar', 'buddypress-toolbar' ) )
	);
}  // end-if BP Group Default Avatar


/**
 * BuddyPress Group Email Subscription (free, by Deryk Wenaus + boonebgorges)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-group-email-subscription/bp-activity-subscription.php' ) ) || function_exists( 'ass_loader' ) ) {
	$menu_items['ext-bpgroupemailsubs'] = array(
		'parent' => $extensions,
		'title'  => __( 'Group Email Subscription', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=ass_admin_options' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Group Email Subscription', 'buddypress-toolbar' ) )
	);
}  // end-if BP Group Email Subscription



/**
 * BP GTM System (free, by slaFFik, valant)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'bp-gtm-system/bp-gtm.php' ) ) || function_exists( 'bp_gtm_init' ) ) {
	$menu_items['ext-bpgtm'] = array(
		'parent' => $extensions,
		'title'  => __( 'BP GTM System', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=bp-gtm-admin' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BP GTM System', 'buddypress-toolbar' ) )
	);
}  // end-if BP GTM System


/**
 * Buddypress User Account Type Lite (free, by Rimon Habib)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-user-account-type-lite/buddypress-user-account-type.php' ) ) || function_exists( 'buat_activate' ) ) {

	// Entries at "Extensions" level submenu
	$menu_items['ext-bpuatl'] = array(
		'parent' => $extensions,
		'title'  => __( 'User Account Type Lite', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=user-account-type' ),
		'meta'   => array( 'target' => '', 'title' => __( 'User Account Type Lite', 'buddypress-toolbar' ) )
	);

	// Entries at "Users" level submenu
	$menu_items['bpfields-bpuatl'] = array(
		'parent' => $bppfields,
		'title'  => __( 'User Account Type Lite', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=user-account-type' ),
		'meta'   => array( 'target' => '', 'title' => __( 'User Account Type Lite', 'buddypress-toolbar' ) )
	);
}  // end-if BP User Account Type Lite


/**
 * BuddyStream (free, by Peter Hofman)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddystream/buddystream.php' ) ) || function_exists( 'buat_activate' ) ) {
	$menu_items['extbuddystream'] = array(
		'parent' => $extensions,
		'title'  => __( 'BuddyStream', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=buddystream_admin' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BuddyStream', 'buddypress-toolbar' ) )
	);
	$menu_items['extbuddystream-dashboard'] = array(
		'parent' => $extbuddystream,
		'title'  => __( 'Dashboard', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=buddystream_admin' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Dashboard', 'buddypress-toolbar' ) )
	);
	$menu_items['extbuddystream-powercentral'] = array(
		'parent' => $extbuddystream,
		'title'  => __( 'Powercentral', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=buddystream_admin&settings=powercentral' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Powercentral', 'buddypress-toolbar' ) )
	);
	$menu_items['extbuddystream-settings'] = array(
		'parent' => $extbuddystream,
		'title'  => __( 'General Settings', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=buddystream_admin&settings=general' ),
		'meta'   => array( 'target' => '', 'title' => __( 'General Settings', 'buddypress-toolbar' ) )
	);
	$menu_items['extbuddystream-cronjob'] = array(
		'parent' => $extbuddystream,
		'title'  => __( 'Cronjob Settings', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=buddystream_admin&settings=cronjob' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Cronjob Settings', 'buddypress-toolbar' ) )
	);
	$menu_items['extbuddystream-logs'] = array(
		'parent' => $extbuddystream,
		'title'  => __( 'Logs', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=buddystream_admin&settings=log' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Logs', 'buddypress-toolbar' ) )
	);
	$menu_items['extbuddystream-tour'] = array(
		'parent' => $extbuddystream,
		'title'  => __( 'Start Tour', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=buddystream_admin&action=starttour' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Start Tour', 'buddypress-toolbar' ) )
	);
}  // end-if BuddyStream


/**
 * BuddyPress Achievements (free, by Paul Gibbs)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'achievements/loader.php' ) ) || function_exists( 'dpa_init' ) ) {
	$menu_items['ext-achievements'] = array(
		'parent' => $extensions,
		'title'  => __( 'Achievements', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=achievements' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Achievements', 'buddypress-toolbar' ) )
	);
}  // end-if BP Achievements


/**
 * Invite Anyone (free, by Boone Gorges)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'invite-anyone/invite-anyone.php' ) ) || function_exists( 'invite_anyone_init' ) ) {

	// Entries at "Extensions" level submenu
	$menu_items['extinviteanyone'] = array(
		'parent' => $extensions,
		'title'  => __( 'Invite Anyone Settings', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=invite-anyone&subpage=general-settings' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Invite Anyone Settings', 'buddypress-toolbar' ) )
	);
	$menu_items['extinviteanyone-access'] = array(
		'parent' => $extinviteanyone,
		'title'  => __( 'Access Control', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=invite-anyone&subpage=access-control' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Access Control', 'buddypress-toolbar' ) )
	);
	$menu_items['extinviteanyone-cloudsponge'] = array(
		'parent' => $extinviteanyone,
		'title'  => __( 'CloudSponge', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=invite-anyone&subpage=cloudsponge' ),
		'meta'   => array( 'target' => '', 'title' => __( 'CloudSponge', 'buddypress-toolbar' ) )
	);
	$menu_items['extinviteanyone-manage'] = array(
		'parent' => $extinviteanyone,
		'title'  => __( 'Manage Invitations', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=invite-anyone&subpage=manage-invitations' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Manage Invitations', 'buddypress-toolbar' ) )
	);
	$menu_items['extinviteanyone-stats'] = array(
		'parent' => $extinviteanyone,
		'title'  => __( 'Stats', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=invite-anyone&subpage=stats' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Stats', 'buddypress-toolbar' ) )
	);

	// Entries at "Users" level submenu
	$menu_items['usersinviteanyone'] = array(
		'parent' => $users,
		'title'  => __( 'BP Invitations', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=ia_invites' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BP Invitations', 'buddypress-toolbar' ) )
	);
	$menu_items['usersinviteanyone-add'] = array(
		'parent' => $usersinviteanyone,
		'title'  => __( 'Add new Invitation', 'buddypress-toolbar' ),
		'href'   => admin_url( 'post-new.php?post_type=ia_invites' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Add new Invitation', 'buddypress-toolbar' ) )
	);
	$menu_items['usersinviteanyone-invitess'] = array(
		'parent' => $usersinviteanyone,
		'title'  => __( 'Invitees', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit-tags.php?taxonomy=ia_invitees&post_type=ia_invites' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Invitees', 'buddypress-toolbar' ) )
	);
	$menu_items['usersinviteanyone-invitedgroups'] = array(
		'parent' => $usersinviteanyone,
		'title'  => __( 'Invited Groups', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit-tags.php?taxonomy=ia_invited_groups&post_type=ia_invites' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Invited Groups', 'buddypress-toolbar' ) )
	);
}  // end-if Invite Anyone


/**
 * Events Manager (free, by Marcus Sykes)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'events-manager/events-manager.php' ) ) || class_exists( 'EM_Object' ) ) {

	// Entries at "Extensions" level submenu
	$menu_items['exteventsmanager'] = array(
		'parent' => $extensions,
		'title'  => __( 'Events Manager', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=event' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Events Manager', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-add'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Add new Event', 'buddypress-toolbar' ),
		'href'   => admin_url( 'post-new.php?post_type=event' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Add new Event', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-tags'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Event Tags', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit-tags.php?taxonomy=event-tags&post_type=event' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Event Tags', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-categories'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Event Categories', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit-tags.php?taxonomy=event-categories&post_type=event' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Event Categories', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-recurring'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Recurring Events', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=event-recurring' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Recurring Events', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-locations'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Locations', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=location' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Locations', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-bookings'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Bookings', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=event&page=events-manager-bookings' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Bookings', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-settings'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Settings', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=event&page=events-manager-options' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Settings', 'buddypress-toolbar' ) )
	);
	$menu_items['exteventsmanager-help'] = array(
		'parent' => $exteventsmanager,
		'title'  => __( 'Help', 'buddypress-toolbar' ),
		'href'   => admin_url( 'edit.php?post_type=event&page=events-manager-help' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Help', 'buddypress-toolbar' ) )
	);
}  // end-if Events Manager


/**
 * BuddyPress Twitter (free, by Charl Kruger)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-twitter/loader.php' ) ) || function_exists( 'bp_twittercj_init' ) ) {
	$menu_items['ext-bptwitter'] = array(
		'parent' => $extensions,
		'title'  => __( 'BP Twitter Settings', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=bp-twittercj' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BP Twitter Settings', 'buddypress-toolbar' ) )
	);
}  // end-if BP Twitter


/**
 * BP Code Snippets (free, by imath)
 *
 * @since 1.1
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'bp-code-snippets/bp-code-snippets.php' ) ) || function_exists( 'bp_code_snippets_init' ) ) {
	$menu_items['ext-bptwitter'] = array(
		'parent' => $extensions,
		'title'  => __( 'BP Code Snippets Manager', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=bp-cs-admin' ),
		'meta'   => array( 'target' => '', 'title' => __( 'BP Code Snippets Manager', 'buddypress-toolbar' ) )
	);
}  // end-if BP Code Snippets


/**
 * WangGuard (free, by WangGuard Team)
 *
 * @since 1.4
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'wangguard/wangguard-admin.php' ) ) || function_exists( 'wangguard_init' ) ) {

	// Entries at "Users" level submenu
	$menu_items['userswangguard'] = array(
		'parent' => $users,
		'title'  => __( 'WangGuard Moderation Queue', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=wangguard_queue' ),
		'meta'   => array( 'target' => '', 'title' => __( 'WangGuard Moderation Queue', 'buddypress-toolbar' ) )
	);
	$menu_items['userswangguard-wizard'] = array(
		'parent' => $users,
		'title'  => __( 'WangGuard Wizard', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=wangguard_wizard' ),
		'meta'   => array( 'title' => __( 'WangGuard Wizard', 'buddypress-toolbar' ) )
	);
	$menu_items['userswangguard-stats'] = array(
		'parent' => $users,
		'title'  => __( 'WangGuard Statistics', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=wangguard_stats' ),
		'meta'   => array( 'title' => __( 'WangGuard Statistics', 'buddypress-toolbar' ) )
	);

	// Entries at "Extensions" level submenu
	$menu_items['extwangguard'] = array(
		'parent' => $extensions,
		'title'  => __( 'WangGuard Moderation Queue', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=wangguard_queue' ),
		'meta'   => array( 'target' => '', 'title' => __( 'WangGuard Moderation Queue', 'buddypress-toolbar' ) )
	);
	$menu_items['extwangguard-wizard'] = array(
		'parent' => $extwangguard,
		'title'  => __( 'Wizard', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=wangguard_wizard' ),
		'meta'   => array( 'title' => __( 'Wizard', 'buddypress-toolbar' ) )
	);
	$menu_items['extwangguard-stats'] = array(
		'parent' => $extwangguard,
		'title'  => __( 'Statistics', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=wangguard_stats' ),
		'meta'   => array( 'title' => __( 'Statistics', 'buddypress-toolbar' ) )
	);
	$menu_items['extwangguard-config'] = array(
		'parent' => $extwangguard,
		'title'  => __( 'Configuration', 'buddypress-toolbar' ),
		'href'   => admin_url( 'admin.php?page=wangguard_conf' ),
		'meta'   => array( 'title' => __( 'Configuration', 'buddypress-toolbar' ) )
	);
}  // end-if WangGuard


/**
 * Members (free, by Justin Tadlock)
 *
 * @since 1.4
 */
if ( ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'members/members.php' ) ) && current_user_can( 'edit_roles' ) ) {

	// Entries at "Users" level submenu
	$menu_items['u-members'] = array(
		'parent' => $users,
		'title'  => __( 'Members: Adjust Roles &amp; Capabilities', 'buddypress-toolbar' ),
		'href'   => admin_url( 'users.php?page=roles' ),
		'meta'   => array( 'target' => '', 'title' => __( 'Members: Adjust Roles &amp; Capabilities', 'buddypress-toolbar' ) )
	);
	$menu_items['u-members-add'] = array(
		'parent' => $users,
		'title'  => __( 'Members: Add new Role', 'buddypress-toolbar' ),
		'href'   => admin_url( 'users.php?page=role-new' ),
		'meta'   => array( 'title' => __( 'Members: Add new Role', 'buddypress-toolbar' ) )
	);
}  // end-if Members
